/*
 * @Author: ૮₍ ˙О˙₎ა
 * @Date: 2023-08-05 15:05:45
 */
import type { IGetInitData } from '@/types/search'
import { httpYX } from '@/utils/requestYX'
/**
 * @description: 获取热度搜索信息和推荐数据
 * @return {*}
 */
export const reqGetInitData = () => {
  return httpYX<IGetInitData>(`/xhr/search/init.json`, 'POST')
}

/**
 * @description: 用户搜索联想
 * @return {*}
 */
export const reqSearchAutoComplete = (key: string) => {
  return httpYX<[]>(`/xhr/search/searchAutoComplete.json?keywordPrefix=${key}`, 'POST')
}

/**
 * @description: 获取用户搜索内容
 * @return {*}
 */
export const reqGetGoodsList = (value: string) => {
  return httpYX(
    `/xhr/search/search.json?timestamp=1630133434953&needPopWindow=true&searchWordSource=7&stillSearch=false&_stat_search=autoComplete&itemId=0&size=40&upperPrice=-1&floorPrice=-1&matchType=1&categoryId=0&descSorted=false&sortType=0&keyword=${value}`,
    'GET'
  )
}
